import { createStore } from 'vuex'

import app from './app';
import settings from './settings';
import permission from './permission';
import user from './user';
import editor from './editor';
import tagsView from './tagsView';
import errorLog from './errorLog';
import stateFlags from './stateFlags.js';

import getters from './getters';

//因为我把模块拆分了，但是我又不想每次都导入，就通过这个自动导入modules目录下的模块
// const modules = modulesFiles.keys().reduce((modules, modulePath) => {
//   const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
//   const value = modulesFiles(modulePath)
//   modules[moduleName] = value.default
//   return modules
// }, {})

// export default new Vuex.Store({
//   modules: {
//     app,
//     settings,
//     user,
//     permission,
//     tagsView,
//     errorLog,
//     stateFlags,
//     editor
//   },
//   getters
// });


// 调用createStore
export default createStore({
  getters,
  modules: {
    app,
    settings,
    user,
    permission,
    tagsView,
    errorLog,
    stateFlags,
    editor
  },

})